import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    user: {}
  },
  getters: {
    getUsr: state => state.user
  },

  mutations: {
    setUsr(state, usr){
      window.sessionStorage.setItem("usr", JSON.stringify(usr))
      state.user = usr
    },
    logOut(state){
      window.sessionStorage.removeItem("usr")
      window.sessionStorage.removeItem("token")
      state.user = {}
    },

  },
  actions: {
  },
  modules: {
  }
})
